Prevent saving during the tutorial - #700
Conversation
NicholasBatesNZ
left a comment
There was a problem hiding this comment.
Thanks for this, and sorry it sat for so long — it's still needed, #699 is open and I confirmed the autosave timer still overwrites the real save the moment the tutorial starts. I traced every write path on current develop (writeShips, saveWorld, SerialisationManager.serialise) and with this patch they're all covered, so the coverage side looks complete.
One thing to fix before merge though: in StarPort the && !game.isTutorial() guard also skips setTranscendent() (line 127) and setSolShip() (line 405), not just the save — so a tutorial player who uses a star port ends up detached from their ship, since removeObjDelayed(ship) still runs. Star ports are generated in the tutorial world too and the 200 starting credits cover the 10-credit fare, so it's reachable.
Could you keep the isPlayer() check on the outer if and nest only the SaveManager.saveWorld(...) call inside a !game.isTutorial() check? Happy to merge once that's in — no objection to this being a stopgap ahead of a proper SaveManager fix.
Both StarPort transcendence paths gated setTranscendent()/setSolShip() behind the same '&& !game.isTutorial()' guard as the save call, so a tutorial player using a star port got detached from their ship: the outgoing ship was still removed via removeObjDelayed()/replaced via addObjDelayed(), but the hero was never pointed at the new object. Per @NicholasBatesNZ's review: keep the isPlayer() check on the outer if, nest only the SaveManager.saveWorld() call inside !isTutorial().
147003b to
0b1dbe3
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughTutorial gameplay now skips scheduled world saves and saves triggered by StarPort entry or transcendent travel. Normal gameplay retains the existing save behavior. ChangesTutorial Save Protection
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🟡 Moderate · up to If exiting the tutorial leaves the game marked as being in tutorial mode, normal gameplay saves may remain disabled and later progress could be lost. Verify or fix the tutorial state reset before merging. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Rebased onto current |
Addressed: StarPort now keeps isPlayer() on the outer if and nests only SaveManager.saveWorld() inside !isTutorial(), so setTranscendent()/setSolShip() still run during the tutorial.
soloturn
left a comment
There was a problem hiding this comment.
Fix matches your review exactly: isPlayer() stays on the outer if, only SaveManager.saveWorld() is nested inside !isTutorial() at both call sites. All checks green.
Description
This pull request attempts to fix areas where the game still saves whilst the tutorial is active. This is only a temporary solution and changes to
SaveManagermay provide a more comprehensive one in the future.Testing
This should fix #699.